import {
	chargeDepositMakeOrder
} from '@/api/user.js'
export default {
	data() {
		return {
			deviceNo: ''
		}
	},
	methods: {
		// 确认购买押金
		async confDeposit(type, handle, isConf) {
			if (isConf) {
				const content = '您确定要购买 ' + this.btType + 'V 的电池押金？'
				const result = await this.confirm({
					content
				})
				if (!result.confirm) {
					return false
				}
			}

			const res = await chargeDepositMakeOrder({
				type,
				deviceNo: this.deviceNo,
				btType: this.btType || '',
			})
			this.wx_payment(res.data, result => {
				if (result == 1) {
					handle && handle()
				} else {
					this.toast('取消支付')
				}
			})
		},
	}
}
